Skip to content

ci(security): pin claude-code-action to a commit SHA - #233

Merged
dodeja merged 1 commit into
mainfrom
fix/pin-claude-action-sha
May 29, 2026
Merged

ci(security): pin claude-code-action to a commit SHA#233
dodeja merged 1 commit into
mainfrom
fix/pin-claude-action-sha

Conversation

@dodeja

@dodeja dodeja commented May 29, 2026

Copy link
Copy Markdown
Contributor

Pins anthropics/claude-code-action from the mutable @v1 tag to the commit SHA it currently resolves to, in both Claude workflows.

Why

@v1 is a moving tag — if it's ever force-pushed to a compromised commit, every future run executes untrusted code with CLAUDE_CODE_OAUTH_TOKEN (and ANTHROPIC_API_KEY) in scope. GitHub's hardening guide recommends pinning third-party actions to a full commit SHA.

Change

- uses: anthropics/claude-code-action@v1
+ uses: anthropics/claude-code-action@787c5a0ce96a9a6cfb050ea0c8f4c05f2447c251 # v1.0.133

in .github/workflows/claude.yml and .github/workflows/claude-code-review.yml. 787c5a0 is the commit v1 resolved to (= release v1.0.133). Bump the SHA and trailing comment together on future upgrades.

Context

This is the last open item from the Greptile review of #229. The other findings (write permissions, actor authorization) were already resolved by #228; this closes the remaining gap.

🤖 Generated with Claude Code

Greptile Summary

This PR hardens both Claude GitHub Actions workflows by replacing the mutable @v1 tag on anthropics/claude-code-action with the full commit SHA 787c5a0ce96a9a6cfb050ea0c8f4c05f2447c251 (verified as v1.0.133), preventing supply-chain attacks via tag force-push.

  • claude-code-review.yml: Action pinned to full SHA; no functional change to review workflow behavior.
  • claude.yml: Same pin applied to the interactive Claude action, which also holds ANTHROPIC_API_KEY in scope — making this the higher-risk workflow that most benefits from the fix.

Confidence Score: 4/5

Safe to merge — the change is a straightforward security improvement with no functional impact.

Both workflow files correctly pin the action to the verified SHA for v1.0.133. The one remaining gap is that useblacksmith/checkout@v1 in both workflows is still a mutable tag from a third-party action, leaving a partial supply-chain exposure that this PR does not address.

Both workflow files use useblacksmith/checkout@v1 which is still an unpinned third-party action.

Important Files Changed

Filename Overview
.github/workflows/claude-code-review.yml Pins anthropics/claude-code-action from @v1 to full commit SHA 787c5a0ce96a9a6cfb050ea0c8f4c05f2447c251 (v1.0.133); no other changes
.github/workflows/claude.yml Pins anthropics/claude-code-action from @v1 to full commit SHA 787c5a0ce96a9a6cfb050ea0c8f4c05f2447c251 (v1.0.133); no other changes

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[PR or Issue Event] --> B{Workflow}
    B --> C[claude.yml]
    B --> D[claude-code-review.yml]
    C --> E[useblacksmith/checkout at v1 - unpinned]
    D --> F[useblacksmith/checkout at v1 - unpinned]
    E --> G[anthropics/claude-code-action at 787c5a0 - pinned]
    F --> H[anthropics/claude-code-action at 787c5a0 - pinned]
    G --> I[Secrets: CLAUDE_CODE_OAUTH_TOKEN + ANTHROPIC_API_KEY]
    H --> J[Secrets: CLAUDE_CODE_OAUTH_TOKEN]
Loading

Comments Outside Diff (1)

  1. .github/workflows/claude-code-review.yml, line 34 (link)

    P2 useblacksmith/checkout also uses a mutable tag

    useblacksmith/checkout@v1 (used in both workflows) is itself an unpinned third-party action. While it doesn't have API secrets passed to it directly, a compromised v1 tag could tamper with the checked-out source before the subsequent Claude step runs. Pinning it to a full commit SHA would make the security posture consistent across both actions in these workflows.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: .github/workflows/claude-code-review.yml
    Line: 34
    
    Comment:
    **`useblacksmith/checkout` also uses a mutable tag**
    
    `useblacksmith/checkout@v1` (used in both workflows) is itself an unpinned third-party action. While it doesn't have API secrets passed to it directly, a compromised `v1` tag could tamper with the checked-out source before the subsequent Claude step runs. Pinning it to a full commit SHA would make the security posture consistent across both actions in these workflows.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
.github/workflows/claude-code-review.yml:34
**`useblacksmith/checkout` also uses a mutable tag**

`useblacksmith/checkout@v1` (used in both workflows) is itself an unpinned third-party action. While it doesn't have API secrets passed to it directly, a compromised `v1` tag could tamper with the checked-out source before the subsequent Claude step runs. Pinning it to a full commit SHA would make the security posture consistent across both actions in these workflows.

Reviews (1): Last reviewed commit: "ci(security): pin claude-code-action to ..." | Re-trigger Greptile

`anthropics/claude-code-action@v1` is a mutable tag — a force-push of a
compromised release would run with CLAUDE_CODE_OAUTH_TOKEN in scope. Pin
both workflows to the commit the tag currently resolves to, per GitHub's
third-party action hardening guidance.

787c5a0 == tag v1.0.133. Bump the SHA (and the trailing comment) together
when upgrading.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented May 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api Ready Ready Preview, Comment May 29, 2026 10:45pm

Request Review

@dodeja
dodeja merged commit 7b8ac8f into main May 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant